package com.jiabo.mapper;

import com.jiabo.pojo.Order;
import com.jiabo.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;


public interface IOrderMapper {
    //查询所有用户、同时查询每个用户关联的订单信息
    @Results({
            @Result(property = "id", column ="id" ),
            @Result(property ="orderTime" , column = "orderTime" ),
            @Result(property = "total", column = "total"),
            @Result(property = "user", column = "uid", javaType = User.class,
                    one=@One(select = "com.jiabo.mapper.IUserMapper.findUserById"))
    })
    @Select("select * from orders")
    List<Order> findOrderAndUser();
}
